using System;
using System.Collections.Generic;
using System.Text;
using CMS.BIZ;
using AAM.DAL;
using AAM.BIZ;
using AAM.SQL;

namespace CMS.BOP
{
    public class SqlBizMessageGroupItemProvider : SqlBizObjectProvider<BizMessageGroupItem>
    {
        public BizMessageGroupItem Read(int messageGroupId, int memberId)
        {
            return Read(new ObjectID(BizMessageGroupItem.ObjectType,new object[]{messageGroupId,memberId}));
        }
        public bool Delete(int messageGroupId, int memberId)
        {
            return Delete(new ObjectID(BizMessageGroupItem.ObjectType, new object[] { messageGroupId, memberId })); ;
        }
        public int Delete(int messageGroupId)
        {
            //TODO also delete from identitymap
            Command command = Connection.CreateCommand("DELETE FROM MessageGroupItems WHERE MessageGroupID=?");
            command.AddParameter(messageGroupId);
            int result = command.ExecuteNonQuery();
            command.Dispose();
            return result;
        }
    }
}
